package com.cherrypt.api.model.bo;

import com.cherrypt.api.model.util.BeanUtils;
import com.cherrypt.api.model.dataobject.UserInfo;
import com.cherrypt.api.model.dataobject.UserLogin;
import com.cherrypt.api.model.vo.RegisterVo;

public class RegisterBo {
    public static UserLogin getUserLogin(RegisterVo registerVO) {
        UserLogin userLogin = new UserLogin();
        BeanUtils.copyFieldToBean(registerVO, userLogin);
        return userLogin;
    }

    public static UserInfo getUserInfo(RegisterVo registerVO, int uid, String passkey) {
        UserInfo userInfo = new UserInfo();
        BeanUtils.copyFieldToBean(registerVO, userInfo);
        userInfo.setUid(uid);
        // 随机passkey
        userInfo.setPasskey(passkey);
        if (registerVO.getSex() == null) {
            userInfo.setSex(false);
        }
        return userInfo;
    }
}
